package com.example.midushop.service.product.impl;

import com.example.midushop.entity.product.find.GetProduct;
import com.example.midushop.mapper.product.find.GetProductMapper;
import com.example.midushop.service.product.GetProductAllServict;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 查询商品服务接口实现类
 */
@Service
public class GetProductServictImpl implements GetProductAllServict {
    @Autowired
    GetProductMapper productMapper;
    @Autowired
    ProductSKUServiceImpl productSKUService;
    @Autowired
    AttrValueServiceImpl attrValueService;
    @Autowired
    SKU_AttrServiceImpl sku_attrService;
    @Override
    public PageInfo<GetProduct> GetProductAll(int is_marketable,long spu_id, String spu_name, String categoryone_name,String[] categorytwo_name, String categorythree_name, String brand_name, int times, int price_order, int sales_volume_order, int priceOne, int priceTwo, int index, int sum) {
        //开始分页，指定页码与每页记录数
        PageHelper.startPage(index,sum);
        //执行查询，请求会被分页插件拦截
        System.out.println(is_marketable);
        List<GetProduct> getProducts = productMapper.GetProductAll(is_marketable,spu_id,spu_name, categoryone_name,categorytwo_name,categorythree_name,brand_name,times, price_order,sales_volume_order,priceOne,priceTwo);
        return new PageInfo<GetProduct>(getProducts);
    }
}
